home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 081 / logentry.arc / LOGENTRY.C next >
Encoding:
C/C++ Source or Header  |  1987-08-10  |  919 b   |  43 lines

  1. /* LogEntry
  2.  *
  3.  *    by Steve Roughton, August 1987.
  4.  *
  5.  *    Prepends a Fido/Opus log timestamp to the command line args
  6.  *    and echoes the whole thing to the standard output.  Useful
  7.  *    for making custom entries in the log.  Uses the log id '$',
  8.  *    which is supposed to mean 'Sysop Entry'.
  9.  *
  10.  *    Source compiled with Microsoft C 4.0.
  11.  */
  12.  
  13. #include <time.h>
  14. #include <stdio.h>
  15.  
  16. char    *(month [])= {    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  17.             "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
  18.              } ;
  19.  
  20. main (argc, argv)
  21.  
  22.     int    argc ;
  23.     char    *argv [] ;
  24. {
  25.     long        ltime ;
  26.     struct    tm    *now ;
  27.     int        i ;
  28.  
  29.     time (<ime) ;
  30.     now = localtime (<ime) ;
  31.  
  32.     printf ("$ %02d %s %2d:%02d:%02d ",
  33.         now->tm_mday, month [now->tm_mon],
  34.         now->tm_hour, now->tm_min, now->tm_sec) ;
  35.  
  36.     for (i=1 ;  i < argc ;  ++i)
  37.         {    fputs (argv [i], stdout) ;
  38.         fputc (' ', stdout) ;
  39.         }
  40.  
  41.     fputc ('\n', stdout) ;
  42. }
  43.